<div id='user_<%= user.id %>' class='user <%= cycle '','h' %>'>
  <div class='first line'>
    <div class='logo'>
      <%= user_logo_image_tag user,:width => 70 %>
    </div>
    <div class='info'>
      <div class='nick_name'>          
        <%= link_to_remote image_tag('tools/star_on.png') ,
              :url => inverse_star_user_url(user),
              :method => :put,
              :loading => "$('user_#{user.id}_high_star').hide();$('user_#{user.id}_low_star').show()",
              :html => {
                :id => "user_#{user.id}_high_star",
                :style => user.high_star? ? '':'display:none',
                :class => user.star
              }
          %>
        <%= link_to_remote image_tag('tools/star_off.png') ,
              :url => inverse_star_user_url(user),
              :method => :put,
              :loading => "$('user_#{user.id}_low_star').hide();$('user_#{user.id}_high_star').show()",
              :html => {
                :id => "user_#{user.id}_low_star",
                :style => user.high_star? ? 'display:none':'',
                :class => user.star
              }
          %>
        <%= user.nick_name %>
        <b class='<%= user.fetion_version %>'><%= user.fetion_version %></b><%= "-#{user.lite_fetion_status}" if user.lite_fetion_status.wait? and user.fetion_version.lite? %>
      </div>
      <div class='others'>
        <dl>
          <dt>性别：</dt>
          <dd><%= user.sex == 'unknown' ? '<small>待确认</small>' : t(user.sex) %></dd>
        </dl>
        <dl class='email'>
          <dt>邮箱：</dt>
          <dd><%= link_to user.email, "mailto:#{user.email}", :title => "给#{user.nick_name}写封邮件" %></dd>
        </dl>
        <% if user.mobile.present? %>
        <dl>
          <dt>手机：</dt>
          <dd>          
            <% if user.fetion_version.maple20? %>
            <small class='maple20'><%= user.mobile %></small>
            <% elsif user.fetion_version.lite? and user.lite_fetion_status.wait? %>
            <small class='lite'><%= user.mobile %></small> <small class='no'>待确认</small>
            <% elsif user.fetion_version.lite? and user.lite_fetion_status.success? %>          
            <small class='lite'><%= user.mobile %></small> 与 <b class='fetion'><%= user.fetion.name %></b> 绑定
            <% end %>          
          </dd>
        </dl>
        <% end %>
        <% if user.fetion_sid.present? %>
        <dl>
          <dt>信飞号：</dt>
          <dd>          
            <%= user.fetion_sid %>        
          </dd>
        </dl>
        <% end %>
        <% if user.fetion_user_id.present? %>
        <dl>
          <dt>信飞Id：</dt>
          <dd>          
            <%= user.fetion_user_id %>
          </dd>
        </dl>
        <% end %>
      </div>
    </div>
    <div class='times'>
      <dl>
        <dt>
                注册：
        </dt>
        <dd>
          <%= time_ago_in_words user.created_at, false %>前
        </dd>
      </dl>
      <dl>
        <dt>
                最近登录：
        </dt>
        <dd>
          <%= time_ago_in_words user.login_at, false %>前
        </dd>
      </dl>
      <% if user.binded_at.present? %>
      <dl>
        <dt>
                最近绑定：
        </dt>
        <dd>
          <%= time_ago_in_words user.binded_at, false %>前
        </dd>
      </dl>
      <% end %>
    </div>
    <div class='stat'>
      <dl>
        <dt>
                吐司：
        </dt>
        <dd>
          <%= user.user_tool_settings_count %> 片
        </dd>
      </dl>
      <dl class='money'>
        <dt>
          麦粒：
        </dt>
        <dd>
          <%= user.money %>
        </dd>
      </dl>
      <dl>
        <dt>
          <%= supports_sms %>：
        </dt>
        <dd>
          <%= user.sms_count %> 条
        </dd>
      </dl>
      <dl>
        <dt>
          <%= supports_email %>：
        </dt>
        <dd>
          <%= user.emails_count %> 封
        </dd>
      </dl>
    </div>
    <div class='tools'>      
      <div>        
        <%= link_to_remote '绑定飞信',
              :update => "verify_#{user.id}",
              :url => bind_fetion_verify_user_url(user.id),
              :method => :get,
              :loading => small_loading("fetion_verify_#{user.id}", :only_img => true),
              :complete => "$('fetion_verify_#{user.id}').update('绑定飞信');$('verify_#{user.id}').show()",
              :html => {
                :id => "fetion_verify_#{user.id}",
                :class => :h
              }
        %>
      </div>
      <div>
        <%= link_to_function "查看吐司", "show_or_hide_tools(this,'#{user.id}_tools')" %>          
      </div>
      <div>
        <%= link_to_function "查看短信", 
              "
                if($('user_#{user.id}_last_sms').style.display == '') {
                  Effect.BlindUp('user_#{user.id}_last_sms');
                } else {
                  #{ remote_function(:update => "user_#{user.id}_last_sms",
                      :url => last_sms_user_url(user.id),
                      :method => :get,
                      :loading => small_loading("sms_link_#{user.id}", :only_img => true),
                      :complete => "$('sms_link_#{user.id}').update('查看短信');Effect.BlindDown('user_#{user.id}_last_sms')")}
                }
              ",
              :id => "sms_link_#{user.id}" %>          
      </div>
      <div>
        <%= link_to_function '新鲜事',
            "
              if($('feeds_#{user.id}').style.display == '') {
                Effect.BlindUp('feeds_#{user.id}');
              } else {
                #{ remote_function(:update => "feeds_#{user.id}",
                    :url => feeds_user_url(user.id),
                    :method => :get,
                    :loading => small_loading("feeds_link_#{user.id}", :only_img => true),
                    :complete => "$('feeds_link_#{user.id}').update('新鲜事');Effect.BlindDown('feeds_#{user.id}')")}
              }
            ",
            :id => "feeds_link_#{user.id}"
         %>
      </div>
    </div>
  </div>
  <div id='<%= user.id %>_tools' class='line user_tools corner' style="display:none;">
    <div class="title">享用中的吐司：</div>
  <% user.user_tool_settings.each_with_index do |setting,index| %>
    <div class="tool">
      <div class="index"><%= index + 1 %>.</div>
      <div class="name"><%= setting.tool.name %></div>
    <% if setting.is_a?(UserToolSetting::FavoriteSearch) %>        
    <% elsif setting.is_a?(UserToolSetting::Flash) %>
    <% elsif setting.is_a?(UserToolSetting::NumberLocation) %>
    <% elsif setting.is_a?(UserToolSetting::SiteHealth) %>
      <div title="网站url"><%= link_to setting.site_url, setting.site_url, :target => :_blank %></div>
      <div title="关键字"><%= setting.content_keyword %></div>
      <div>每日<%= setting.report_hour %>提醒</div>
    <% elsif setting.is_a?(UserToolSetting::WeatherForecast) %>
      <div><%= setting.city.full_name %></div>
      <div>每日<%= setting.forecasted_hour %>预报</div>
    <% end %>
      <div>享用于<%= time_ago_in_words setting.created_at, false %>前</div>
    </div>
  <% end %>
  </div> 
  <div id='user_<%= user.id %>_last_sms' class='line last_sms' style='display:none' onmouseover="Try.these(function() { $('user_<%= user.id %>_menu').show() });" onmouseout="Try.these(function() { $('user_<%= user.id %>_menu').hide() });">    
  </div>
  <div id="verify_<%= user.id %>" class="fetion_verify corner" style='display:none'></div>
  <div id="feeds_<%= user.id %>" class="feeds" style='display:none'
    onmouseover="Try.these(function() { $('user_<%= user.id %>_feeds_menu').show() });" onmouseout="Try.these(function() { $('user_<%= user.id %>_feeds_menu').hide() });"></div>
</div>
